def checkId():
    userId=input("请输入用户id:")
    if len(userId)==0 and len(userId)>9:
        print("id不合法")
        checkId()
    if userId.isalnum()==False:
        print("用户名只能由数字、字母、下划线组成")
        checkId()
    else:
        print("id格式正确")

    return userId


def chickEmail():
     userEmail=input("请输入Email地址：")
     if userEmail.find("@")==-1 or not userEmail.endswith(".com"):
         print("邮箱格式错误")


     else:
         print("邮箱格式正确")
         return userEmail


def chickIdCard():
    message1="性别为男"
    message2 = "性别为女"
    userIdCard=input("输入身份证号：")
    if len(userIdCard)!=18:
        print("身份证号格式错误")
        chickIdCard()
    sex=userIdCard[14:17]
    if int(sex)%2==0:
        print(message2)
    else:
        print(message1)
        return userIdCard

def isChinese(word):
    for ch in word:
        if '\u4e00' <= ch <= '\u9fff':
            return True
    return False

def checkName():
    userName=input("输入姓名：")
    if isChinese(userName)==False:
        print("用户名只能为中文")
        checkName()
    else:
        if len(userName)==0 or len(userName)>8:
            print("用户名长度不合法")
            checkName()
            return userName



print("用户名：",checkId(),
"邮箱地址",chickEmail(),
"身份证号为：",chickIdCard(),
"姓名：",checkName())


